﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace BanHangCshap.Class.DAL
{
    public abstract class HangHoaDAL:clsBaseDAL
    {
        /// <summary>
        /// Lấy danh sách hàng hóa cho chọn để mua bán
        /// </summary>
        /// <returns></returns>
        public DataTable LayHangHoaChoChon()
        {
            return base.Select("sp_LayHangHoaChoChon");
        }

        /// <summary>
        /// Lấy danh sách hàng hóa cho danh mục hàng hóa
        /// </summary>
        /// <param name="ListValu"></param>
        /// <returns></returns>
        public DataTable LayHangHoaChoDanhSach()
        {
            return base.Select("sp_LayHangHoaChoDanhSach");
        }

        public bool CapNhatTrucTiep(Entities.HangHoa o)
        {
            string SPName = "sp_CapNhapTrucTiep";
            string[] ListPara = {"@mahang"
                                    ,"@tenhang"
                                    ,"@dvt"
                                    ,"@mota"
                                    ,"@gianhap"
                                    ,"@giaxuatsi"
                                    ,"@giaxuatle"
                                    ,"@tondinhmuc"
                                    ,"@ghichu"
                                    ,"@maloai"
                                    ,"@giaxuattienmat"
                                 };
            object[] ListValu = {o.mahang
                                    ,o.tenhang
                                    ,o.dvt
                                    ,o.mota
                                    ,o.gianhap
                                    ,o.giaxuatsi
                                    ,o.giaxuatle
                                    ,o.tondinhmuc
                                    ,o.ghichu
                                    ,o.maloai
                                    ,o.giaxuattienmat
                                  };
            return base.Update(SPName, ListPara, ListValu);
        }
    }
}
